<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>promise</title>
	</head>
	<body>
		<script type="text/javascript">
			Promise.resolve().then(()=>{
				console.log(0);
				return Promise.resolve(4)
			}).then((res)=>{
				console.log(res);
			})
			Promise.resolve().then(()=>{
				console.log(1);
			}).then(()=>{
				console.log(2);
			}).then(()=>{
				console.log(3);
			}).then(()=>{
				console.log(5);
			}).then(()=>{
				console.log(6);
			})
			//此时输入的结果为 1,2,3,4,5,6
			
			/* new Promise((resolve,reject)=>{
				console.log(0);
				return resolve(4);
			}).then((res)=>{
				console.log(res);
			})
			new Promise((resolve,reject)=>{
				console.log(1);
				return resolve(2)
			}).then((res)=>{
				console.log(res);
				return new Promise((solve,reject)=>{
					solve(3)
				})
			}).then((res)=>{
				console.log(res);
				return new Promise((resolve,reject)=>{
					resolve(5)
				})
			}).then((res)=>{
				console.log(res);
				return new Promise((resolve,reject)=>{
					resolve(6)
				})
			}).then((res)=>{
				console.log(res);
			}); */
			//此时输出为 0,1,4,3,5,6
		</script>
	</body>
</html>
